<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        let date= new Date()
        var c = console.log.bind(document)
        c(fn(date))
// 结构时间戳
        function fn(date){
        var year = date.getFullYear()
        var mouth = date.getMonth() +1
        var day = date.getDate()
        var hour = date.getHours()
        var Minute = date.getMinutes()
        var second = date.getSeconds()
        var seconds = date.getMilliseconds()
            // ${} 里面的是运算 外面的是字符串拼接
            // 详情请参考ES6 - 02 ES6基础>
        return `${year}-${mouth}-${day}-${hour}-${Minute}-${second}-${seconds}`
    }
        
    </script>
</body>
</html>